package com.zch.spring_demo.work.service.impl;

import com.zch.spring_demo.work.domain.IUserDao;
import com.zch.spring_demo.work.domain.User;
import com.zch.spring_demo.work.service.IUserService;
import com.zch.spring_demo.work.base.WorkServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author biscuit
 * @data 2018/01/16
 * 只用继承 WorkServiceImpl指定依赖dao的类型和实体类的类型，再实现一个构造构造方法，
 * 就实现了所有的spring data jpa的方法
 */
@Service
public class UserServiceImpl extends WorkServiceImpl<IUserDao,User> implements IUserService {
    private IUserDao dao = null;
    @Autowired
    public UserServiceImpl(IUserDao dao) {
        super(dao);
        this.dao = dao;
    }

    @Override
    public User findByUsername(String username) {
        return dao.findByUsername(username);
    }

    @Override
    public User findByUsernameOrPassword(String username, String password) {
        return dao.findByUsernameOrPassword(username,password);
    }
}
